import { Prop, Schema } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { UserSetting } from './user-setting.schema';

@Schema({ timestamps: true })
export class User extends Document {
  @Prop({ required: true, index: true })
  username: string;

  @Prop({})
  nickName: string;

  @Prop({ enum: [0, 1], default: 1 })
  status: number;

  @Prop({ required: true })
  password: string;

  @Prop({ type: Object, childSchemas: true })
  settings: UserSetting;

  @Prop({ enum: ['user', 'admin'], default: 'user' })
  role: string;
}
